#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#define SIZE 6
int main()
{
	int n = 0;
	int i = 0;
	for (i = 0; i < 100000; i++)
	{
		n = i;
		int arr1[SIZE] = { 0 };
		int arr2[SIZE] = { 0 };
		int* p1 = arr1;
		int* p2 = arr2;
		int count = 0;
		while (n != 0)
		{
			*p1 = n % 10;
			n /= 10;
			*p2 = 1;
			count++;
			p1++;
			p2++;
		}
		for (count; count > 0; count--)
		{
			for (int j = 0; j < SIZE; j++)
			{
				arr2[j] *= arr1[j];
			}
		}
		int sum = 0;
		for (int k = 0; k < SIZE; k++)
		{
			sum += arr2[k];
		}
		if (sum == i)
		{
			printf("%d ", i);
		}
	}
	return 0;
}